home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SunSoft Catalyst CDWARE 1996 May to August
/
Catalyst CDWARE 1996 May to August.iso
/
.products
/
.bin
/
httpd
/
Solaris_2
/
catIPX.bkcsh
< prev
next >
Wrap
Text File
|
1995-06-27
|
3KB
|
156 lines
#!/bin/csh
# below is a scrpit launched by catIPX.pl from the Solaris Product
# Expo home page. It ultimately generates a query page to be
# displayed by the cgi-bin/catIPX.pl script.
# December 14, 1994 Marc Sacoolas
#
# Get search string, filter-type and category
#
set keyword = `awk -F^ '{ print $1 }' /tmp/httpd/tmp `
set filter = `awk -F^ '{ print $2 }' /tmp/httpd/tmp `
set catagory = `awk -F^ '{ print $3 }' /tmp/httpd/tmp `
set catword = `awk -F^ '{ print $3 }' /tmp/httpd/tmp `
set display = `awk -F^ '{ print $4 }' /tmp/httpd/tmp `
# clear temporary files
set srchtyp = "topics or products"
rm /tmp/httpd/top
touch /tmp/httpd/top
rm /tmp/httpd/tmp
touch /tmp/httpd/tmp
#
# goto index.html directory and grep files for keyword
#
cd ../../.products
foreach dir (`ls`)
set yes = `grep -il $keyword $dir/index.html`
if ( $yes != "" )
# read in company name and log
awk -F ' { if (NR == 1) {print $0}}' $dir/_info > /tmp/httpd/top
cd ../.bin/httpd/cgi-bin
# create top file with search string including or operator
awk -F ' { \
if ( n==2 )printf("|") \
printf($1) \
n=2 \
}' /tmp/httpd/tmp >> /tmp/httpd/top
set topcat = `awk -F^ '{ print $1 }' /tmp/httpd/top `
# print lines wich match company names given by grep
awk -F ' BEGIN { } \
{\
if ( $1 ~ /'"$topcat"'/ ) print $0\
}' /tmp/httpd/dbase.isv >> /tmp/httpd/dbase.tmp
breaksw
endsw
else
set srchtyp = "categories"
# catagory field is not Category...get category
awk -F^ ' BEGIN { } \
{ \
if ( n == 1 ) catword = $3 \
if ( n == 2 && $4 ~ /'"$catword"'/ ) print $0 \
}' n=1 /tmp/httpd/tmp n=2 /tmp/httpd/dbase.isv >> /tmp/httpd/dbase.tmp
endif
# remove old page
rm /tmp/httpd/isv.grfx.html
#
# creat new page based on resource file generated above if Logos is requested
#
cat /tmp/httpd/head.html > /tmp/httpd/isv.grfx.html
# get number of answers and print
set return = `grep -c ^ /tmp/httpd/dbase.tmp`
if ( $return == 1 ) then
set booths = "booth."
else
set booths = "booths."
endif
echo "<I> Your search of </I>'<B>$srchtyp</B>' <I>for </I>'<B>$keyword</B>' <I>produced </I><B>$return</B> <I> $booths</I>" >> /tmp/httpd/isv.grfx.html
echo "<p>" >> /tmp/httpd/isv.grfx.html
if ( $display == "logo" ) then
awk -F^ '{ \
if (flag == 0) \
{ \
printf("<a href="$2"><img align=middle src="$3" alt=""></a>") \
for (c = 0;c < 1;c++) \
printf(" ") \
flag=1 \
}\
else \
{\
print "<a href="$2"><img align=middle src="$3" alt=""></a>" \
print "<p>" \
flag=0 \
} \
}' /tmp/httpd/dbase.tmp >> /tmp/httpd/isv.grfx.html
else
awk -F^ '{ \
print "<H2><a href="$2">"$1"</a></H2>" \
}' /tmp/httpd/dbase.tmp >> /tmp/httpd/isv.grfx.html
endif
if ( `/usr/ucb/test -s /tmp/httpd/dbase.tmp`)then
echo "then"
else
echo "else"
endif
#
# if nothing was placed in dbase.tmp, put message there
#
if (-z /tmp/httpd/dbase.tmp) then
echo "<pre>" >> /tmp/httpd/isv.grfx.html
echo "</pre>" >> /tmp/httpd/isv.grfx.html
echo "<H2> Go Back and try again.</H2>" >> /tmp/httpd/isv.grfx.html
endif
# put footer on html page
cat /tmp/httpd/tail.html >> /tmp/httpd/isv.grfx.html
#
# clear dbase.tmp file
#
rm /tmp/httpd/dbase.tmp
touch /tmp/httpd/dbase.tmp
exit 0
#setenv KEYWORD2 `echo "$keyword" | sed 's/\[//g' | sed 's/]//g'`
#set keyword = `cat /tmp/httpd/tmp`